package com.hand.wyc24548.infra.repository.impl;

import org.hzero.mybatis.base.impl.BaseRepositoryImpl;
import org.springframework.stereotype.Component;

import com.hand.wyc24548.domain.entity.Customer;
import com.hand.wyc24548.domain.repository.CustomerRepository;
import com.hand.wyc24548.infra.mapper.CustomerMapper;

import io.choerodon.core.domain.Page;
import io.choerodon.mybatis.pagehelper.PageHelper;
import io.choerodon.mybatis.pagehelper.domain.PageRequest;

/**
 * @Author wangyc
 * @create 2019/8/8 20:10
 */

@Component
public class CustomerRepositoryImpl extends BaseRepositoryImpl<Customer> implements CustomerRepository {

    private final CustomerMapper customerMapper;

    public CustomerRepositoryImpl(CustomerMapper customerMapper) {
        this.customerMapper = customerMapper;
    }

    @Override
    public Page<Customer> selectCustomer(Customer customer, PageRequest pageRequest) {
        return PageHelper.doPage(pageRequest,() -> customerMapper.selectCustomer(customer));
    }
}
